<template>
  <div class="box">
    <div class="top1">
      <p class="title">实时游客统计</p>
      <div class="bg"></div>
      <p class="right">
        可预约总量
        <span>99999</span>
        人
      </p>
    </div>
    <div class="number">
      <span v-for="(item, index) in people" :key="index">{{ item }}</span>
    </div>
    <!-- 盒子将来echarts来展示图形图标的节点 -->
    <div class="charts" ref="charts">123</div>
  </div>
</template>

<script lang='ts' setup>
import { ref, reactive, onMounted } from 'vue'
import * as echarts from 'echarts';
import 'echarts-liquidfill'
let charts = ref()

onMounted(() => {
  // DOM元素挂载组件实例，图表初始化
  // 获取echarts类的实例
  let mycharts = echarts.init(charts.value);
  // 设置实例的配置项
  mycharts.setOption({
    title: {
      text: '水球图'
    },
    // x,y轴组件
    xAxis: {},
    yAxis: {},
    // 系列 展示图形图标
    series: {
      type: 'liquidFill', //系列
      waveAnimation: true, //开启波浪动画
      animationDuration: 3,
      animationDurationUpdate: 0,
      radius: '90%', //半径
      data: [0.6, 0.4, 0.2],//展示的数据
      outline: {
        show: true,
        borderDistance: 0,
        itemStyle: {
          color:'red',
          borderColor: '#156ACF',
          shadowBlur: 20,
          shadowColor: 'rgba(255, 0, 0, 1)'
        }
      }

    },
    // 布局组件
    grid: {
      left: 0,
      right: 0,
      top: 0,
      bottom: 0
    }
  })
})

let people = ref('215908人')
</script>

<style lang='scss' scoped>
.box {
  background: url(../../images/dataScreen-main-lb.png) no-repeat;
  background-size: 100% 100%;
  margin-top: 10px;

  .top1 {
    margin-left: 20px;

    .title {
      color: white;
      font-size: 20px;
    }
    .bg {
      width: 68px;
      height: 7px;
      background: url(../../images/dataScreen-title.png) no-repeat;
      background-size: 100% 100%;
      margin-top: 10px;
    }
    .right {
      float: right;
      color: white;
      font-size: 20px;

      span {
        color: #ccc;
      }
    }
  }

  .number {
    padding: 10px;
    margin-top: 30px;
    display: flex;

    span {
      flex: 1;
      font-size: 20px;
      height: 40px;
      text-align: center;
      line-height: 40px;
      color: #29fcff;
      background: url(../../images/total.png) no-repeat;
    }
  }

  .charts {
    width: 100%;
    height: 250px;
  }
}
</style>